package eerbaar.v2.graphics.rect;

import java.awt.Point;


public class RectMove {

    public static Rectangle2 move(Rectangle2 rect, int x, int y) {

        int top = rect.y + y;
        int left = rect.x + x;

        return new Rectangle2(left, top, rect.width, rect.height);
    }

    public static Rectangle2 moveDown(Rectangle2 rect, int y) {

        int top = rect.y + y;

        return new Rectangle2(rect.x, top, rect.width, rect.height);
    }

    public static Rectangle2 moveLeft(Rectangle2 rect, int x) {

        int left = rect.x - x;

        return new Rectangle2(left, rect.y, rect.width, rect.height);
    }

    public static Rectangle2 moveRight(Rectangle2 rect, int x) {

        int left = rect.x + x;

        return new Rectangle2(left, rect.y, rect.width, rect.height);
    }

    public static Rectangle2 moveToPoint(Rectangle2 rect, Point point) {

        int left = rect.x + point.x;
        int top = rect.y + point.y;

        return new Rectangle2(left, top, rect.width, rect.y);
    }

    public static Rectangle2 moveUp(Rectangle2 rect, int y) {

        int top = rect.y - y;

        return new Rectangle2(rect.x, top, rect.width, rect.height);
    }

}
